package org.woosiyuan.action;

import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import java.util.Map;

import sun.org.mozilla.javascript.internal.json.JsonParser;

import com.opensymphony.xwork2.ActionSupport;

public class MovePtz extends ActionSupport {

	private String dir;

	public String getDir() {
		return dir;
	}

	public void setDir(String dir) {
		this.dir = dir;
	}

	@Override
	public String execute() throws Exception {
		send_url("http://192.168.1.106:81/moveptz.xml?user=admin&usr=admin&password=admin&pwd=admin&dir="
				+ dir);
		return null;
	}

	

	public void send_url(String urlStr) throws Exception {
		URL url;
		HttpURLConnection url_con;
		url = new URL(urlStr);
		url_con = (HttpURLConnection) url.openConnection();
		url_con.connect();
		Map<String,List<String>> map = url_con.getHeaderFields();
		//遍历所有的响应头字段
		for (String key : map.keySet())
		{
		System.out.println(key + "--->" + map.get(key));
		}
	}
}
